package com.lw.learnyx.controller;

import com.lw.learnyx.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.mail.MessagingException;
import java.security.GeneralSecurityException;

/**
 * @author LW
 * @2020/12/24 16:44
 */
@Controller
public class TestController {

    @Autowired
    MailService mailService;

    @RequestMapping("/sendMail")
    public String sendMail(@RequestParam("email")String email) throws GeneralSecurityException, MessagingException {
        mailService.sendMail(email);
        return "index";
    }

}
